
#include"stack.h"
#include<string.h>
#include<iostream.h>
#include<stdlib.h>

using namespace std;


template<class typ> stack<typ>::stack(){
   s = new typ[1000];
   accumulate = new typ[1000];
   top = NULL;
}
//===========================================
template<class typ> stack<typ>::stack(int usersize){
   s = new typ[usersize];
   accumulate = new typ[usersize];
   top = NULL;
   victorypilestack = new string[2000];
}
//===========================================
template <class typ> bool stack<typ>::full(){
   if (top == 99)
      return true;
   else
      return false;
}
//===========================================
template <class typ> bool stack<typ>::empty(){
   if (top == NULL)
      return true;
   else
      return false;
}
//===========================================
template<class typ> void stack<typ>::push(typ x){
   top++;
   s[top] = x;
}
//===========================================
template<class typ> typ stack<typ>::pop()
{
   if (top != 0)
   {
      typ temp = s[top];
      s[top] = NULL;
      top--;
      return temp;
   }
   else{
      top = NULL;
      return NULL;
   }
}
//==========================================
template<class typ> void stack<typ>::displaybottomup(){
   int x = 1;                                         //we start at one because
   while (x < top+1){                                   //i made the array start at
      cout<<s[x]<<endl;                                  //one and not zero.
      x++;
   }
}
//==========================================
template<class typ> void stack<typ>::displaytopdown(){
   int x = top;                                         //we start at one because
   while (x >= 1){                                 //i made the array start at
      cout<<s[x]<<endl;                                  //one and not zero.
      x--;

   }
}
//==========================================
template<class typ> char *stack<typ>::getstringstack(){
   int x = 0;

   while (x < top){
      accumulate[x] = s[x+1];
      x++;
   }
   accumulate[x] = '\0';
   return accumulate;
}
//==========================================
template<class typ> int stack<typ>::count(){
   int x = 0;

   while (x < top){
      x++;
   }
   return x;
}
//==========================================
template<class typ> void stack<typ>::pushmanychar(char *x){

//cout<<"length is: "<<strlen(x)<<endl;

   for (int a = 0; a < strlen(x); a++){
      push(x[a]);
   }
}
//============================================
template<class typ> void stack<typ>::addtovictory(char *x){

   //for (int a = 0; a < strlen(x); a++){
   //victorypilestack[top][a] = *x;
   //}
   //top++;
}